<?php

class My_Auth_Adapter_LastFm  implements Zend_Auth_Adapter_Interface
{

    private $_name;

    /**
     *
     * @var Facebook
     */

    private $_key;


    /**
     *
     * @param Facebook $facebook
     */

    public function __construct($name, $key)
    {
        $this->_name = $name;
        $this->_key = $key;
    }

    public function authenticate()
    {
        $db = Zend_Db_Table::getDefaultAdapter();

        $id = $db->fetchOne("SELECT last_fm_username FROM user WHERE last_fm_username = ".$db->quote($this->_name));


        return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $id);
    }
}